package com.lcm.basic.p7.map;

import java.util.*;

/**
 * @author Coder-lcm
 * @date 2021/4/3
 */
public class MapDemo {
    public static void main(String[] args) {
        HashMap<Integer, String> hashMap = new HashMap();
        Hashtable<Integer, String> hashtable = new Hashtable<>();
        LinkedHashMap<Integer,String> linkedHashMap = new LinkedHashMap<>();
        TreeMap<Integer, String> treeMap = new TreeMap<>();
        for (Integer a : Arrays.asList(12,45,65,32,13,68,89,31)){
            hashMap.put(a, a + "");
            linkedHashMap.put(a, a + "");
            treeMap.put(a, a + "");
            hashtable.put(a, a + "");
        }
        System.out.println(hashMap); //{32=32, 65=65, 68=68, 89=89, 12=12, 45=45, 13=13, 31=31}
        System.out.println(linkedHashMap);// {12=12, 45=45, 65=65, 32=32, 13=13, 68=68, 89=89, 31=31}
        System.out.println(treeMap);// {12=12, 13=13, 31=31, 32=32, 45=45, 65=65, 68=68, 89=89}
        System.out.println(hashtable); // {32=32, 65=65, 31=31, 68=68, 13=13, 89=89, 45=45, 12=12}

        hashMap.keySet();
        hashMap.values();
        hashMap.entrySet();
    }
}
